<!doctype html>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>报名表</title>
<link href="../../css/newStyle.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/gbRst.js"></script>
<script type="text/javascript" src="../../js/utils.js"></script>
<script type="text/javascript" src="../../js/openId.js"></script>
<script type="text/javascript" src="../../js/header&footer.js"></script>
<script type="text/javascript" src="../../js/check.js"></script>
<script type="text/javascript" src="../../js/ImageBrowsing.js"></script>
<script type="text/javascript" src="../../js/qmsk-1.2.js"></script>

<script type="text/javascript" src="../../js/my.js"></script>
<script type="text/javascript" src="../../js/ajaxfileupload.js"></script> 
<script type="text/javascript">
var openId = null;
$(function(){
 	browse('upload','image',34,34)
})

function getffOpenId() {
				var openId = null;
				openId = qmsk.getQueryValue("openId");
				if (qmsk.isNotEmpty(openId)) {
					return openId;
				}
				var code = qmsk.getQueryValue("code");
				if (qmsk.isEmpty(code)) {
					return null;
				}

				var response = qmsk.asynGet('../../../wechat/accessToken/' + code);
				if (response == null) {
					return null;
				}
				var temp = response.getValue("accessToken");
				if (qmsk.isEmpty(temp)) {
					alert("获取 openId 失败！");
					return null;
				}
				var accessToken = JSON.parse(temp);
				if ( typeof accessToken.openid === "undefined") {
					alert("获取 openId 失败！");
					return null;
				}
				return accessToken.openid;
			}

function addInfo(){
	var type= $("#type").val();
	var name= $("#name").val();
	var IDNumber= $("#IDNumber").val();
	var address= $("#address").val();
	var phone= $("#phone").val();
	var mp= $("#mp").val();
	var birthday= $("#birthday").val();
	var age= $("#age").val();
	var origin= $("#origin").val();
	var Nation= $("#Nation").val();
	var qq= $("#qq").val();
	var email= $("#email").val();
	var marry= $("#marry").val();
	var school= $("#school").val();
	var height= $("#height").val();
	var weight= $("#weight").val();
	var love= $("#love").val();
	var attention= $("#attention").val();
	var Slogan= $("#Slogan").val();
	var Reward= $("#Reward").val();
	var talent= $("#talent").val();
	
	$("input[type=checkbox]:checked").each(function(){
		var htm =$(this).val();
		attention+="/"+htm
	})
	
	if(!checkNull(name, "姓名", "name")||!checkNull(IDNumber, "身份证", "IDNumber")||!checkNull(address, "住址", "address")||!checkNull(birthday, "出生日期", "birthday")){
		return false
	}
	if(!checkNull(origin, "籍贯", "origin")||!checkNull(Nation, "民族", "Nation")||!checkNull(school, "单位/行业/学校", "school")||!checkNull(height, "身高", "height")||!checkNull(birthday, "体重", "weight")){
		return false
	}
	if(!_checkPhone(mp, false, "手机", "mp")){
		return false
	}
	if(!checkNumber(age, false, "年龄", "age")){
		return false;
	}
	var openId = getffOpenId();
	var heads = new Array("type","name","IDNumber","address","phone","mp","birthday","age","origin","Nation","qq","email","marry","school","height","weight","love","attention","Slogan","Reward","talent","shopId","openId");
	var datas = new Array(type,name,IDNumber,address,phone,mp,birthday,age,origin,Nation,qq,email,marry,school,height,weight,love,attention,Slogan,Reward,talent,_shopId,openId);
	var params= _getJsonParseInsertStr(heads, datas);
	$("#yy").show()
	var dt=_insertInfoNoSucceedMessage("../../../apply/insert/insertInfo", {'data':params});
	if(IsNotEmpty(dt)&&dt.state==0){
		var id = getHeadIndexValue(0, dt, "id");
		uploadImage(id)
	}else{
		$("#yy").hide()

	}

}
function restFrom(){
	$("#yy").hide()
	$("#name").val("");
	 $("#IDNumber").val("");
	$("#address").val("");
	 $("#phone").val("");
	$("#mp").val("");
	 $("#birthday").val("");
	$("#age").val("");
	 $("#origin").val("");
	 $("#Nation").val("");
	 $("#qq").val("");
	$("#email").val("");
	$("#marry").val(0);
	 $("#school").val("");
	 $("#height").val("");
	 $("#weight").val("");
	 $("#love").val("");
	 $("#attention").val("");
	 $("#Slogan").val("");
	 $("#Reward").val("");
	 $("#talent").val("");
	 $("#image img").attr("src","../../images/userImg.jpg");
	 $("#ts").html("请点击上传照片")
}


function uploadImage(id){
	var dd= $("#upload").val()
	if(IsEmpty($("#upload").val())){
		$("#yy").hide()
		alert("报名成功");
		return false;
	}else{
		
	$.ajaxFileUpload({
		url :"../../../apply/upload/images/"+id,
		secureuri : false,
		fileElementId : 'upload',
		dataType : 'json',
		success : function(data){
			if (data.state == 0) {
				$("#yy").hide()
				alert("报名成功")
				restFrom();
			}else if(data.state == 1){
				$("#yy").hide()

				alert("报名失败")
			}
			 	browse('upload','image',34,34)
		},
		error : function(data) {
			$("#yy").hide()
	 		browse('upload','image',34,34)
			return false;
		}
	});

	}

}

function doAfterLoadImage(){
	$("#ts").html($("#upload").val())
}
</script>
</head>

<body>
<div class="wrapper">
  <div class="container">
  <div class="onlyImg"><img src="../../images/MusicHost.jpg"><a href="http://myradio.sinaapp.com/mobile.php?act=module&id=3&name=news&do=detail&weid=2#mp.weixin.qq.comwechat_redirect" style="position:absolute;left:50%;bottom:5px;margin-left:40px;border: solid 1px #ff6f43;
	background: #ff9208;
	background: -webkit-gradient(linear, left top, left bottom, from(#ff9208), to(#b34a01));
	background: -moz-linear-gradient(top, #ff9208, #b34a01);
 filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff9208', endColorstr='#b34a01');text-shadow: 0 1px 1px rgba(0,0,0,.6);
	-webkit-border-radius: 3px;
	-moz-border-radius: 3px;
	border-radius: 3px;
	-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
	-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
	box-shadow: 0 1px 2px rgba(0,0,0,.2);
	color: #e8f0de;padding:2px 5px;font-size:14px;">查看活动详情</a></div>
  		<div class="onlyImg host">
        	<label id="image" ><img src="../../images/userImg.jpg"></label><input type="file" id="upload" name="upload" style="width:110px;height:130px;position:absolute;margin-left:-55px;left:50%;opacity:0;z-index:30;">
            <div class="imgStatus" id="ts">请点击上传照片</div>
            <p style="text-align:left;color:#666;font-size:11px;"><span class="red">温馨提示：</span>若点击上传照片无反应，请点击右上角按钮，选择“在浏览器中打开”进行操作</p>
        </div>
        <div class="person">
            赛区<span class="red">*</span><br>
            <select style="width:99%;box-sizing:border-box;" id="type"><option value="0">高校</option><option value="1">大众</option></select>
        </div>
        <div class="person">
            姓名<span class="red">*</span><br>
            <input name="custName" id="name" type="text" class="txt">
        </div>
        <div class="person">
            身份证号<span class="red">*</span><br>
            <input type="text" id="IDNumber" class="txt">
        </div>
        <div class="person">
            住址<span class="red">*</span><br>
            <input type="text" id="address" class="txt">
        </div>
        <div class="person">
            住宅电话<br>
            <input type="text" id="phone" class="txt">
        </div>
        <div class="person">
            移动电话<span class="red">*</span><br>
            <input type="text" id="mp" class="txt">
        </div>
        <div class="person">
            出生日期<span class="red">*</span><br>
            <input type="text" id="birthday" class="txt" readonly>
        </div>
        <div class="person">
            年龄<span class="red">*</span><br>
            <input type="text" id="age" class="txt">
        </div>
        <div class="person">
            籍贯<span class="red">*</span><br>
            <input type="text" id="origin" class="txt">
        </div>
        <div class="person">
            民族<span class="red">*</span><br>
            <input type="text" id="Nation" class="txt">
        </div>
        <div class="person">
            QQ<br>
            <input type="text" id="qq" class="txt">
        </div>
        <div class="person">
            邮箱<br>
            <input type="text" id="email" class="txt">
        </div>
        <div class="person">
            婚姻状况<span class="red">*</span><br>
            <select style="width:99%;box-sizing:border-box;" id="marry"><option value="0">未婚</option><option value="1">已婚</option></select>
        </div>
        <div class="person">
            单位/行业/学校<span class="red">*</span><br>
            <input type="text" id="school" class="txt">
        </div>
        <div class="person">
            身高(cm)<span class="red">*</span><br>
            <input type="text" id="height" class="txt">
        </div>
        <div class="person">
            体重(kg)<span class="red">*</span><br>
            <input type="text" id="weight" class="txt">
        </div>
        <div class="person">
            爱好<br>
            <input type="text" id="love" class="txt">
        </div>
        <p class="mainTxt">参加“我是女主播”选秀比赛，你对自己最有信心的是哪方面？<br><label class="check"><input type="checkbox" value="外表">外表</label><label class="check"><input type="checkbox" value="声音">声音</label><label class="check"><input value="知识储备" type="checkbox">知识储备</label><label class="check"><input value="个性魅力" type="checkbox">个性魅力</label><label class="check"><input value="良好的心理素质" type="checkbox">良好的心理素质</label><br><label class="check"><input type="checkbox" >其他<input type="text" id="attention"  style="border:none;border-bottom:1px solid #ccc;margin:-2px 0 0 5px;"/></label></p>
        <div class="person">
            你有独特的参赛口号和表现形式吗？是什么	<br>
            <textarea id="Slogan"></textarea>
        </div>
        <div class="person">
            个人经历、曾获奖励？<br>
            <textarea id="Reward"></textarea>
        </div>
        <div class="person">
            除了主播外有何特殊才能和才艺？(如:乐器、歌曲原创、模仿、表演、舞蹈、戏曲等，技巧程度如何，得过何种荣誉）<br>
            <textarea id="talent"></textarea>
        </div>
        <h4>注意事项：</h4>
        <p class="txt">① 参选者在选手资料表内填写的任何个人资料均为赛事主办方所保存及使用。</p>
        <p class="txt">② 请选手提供可随时直接联络到本人的电话号码，并保证24小时畅通。</p>
        <p class="txt">③ 请在指定处粘贴好一张1寸或5寸正面免冠近照。</p>
        <div class="give">
            <input type="button" value="提交申请" class="giveBtn" onclick="addInfo()">
        </div>
  </div>
</div>
</body>
</html>
